<h:panelGrid columns="2" xmlns:h="http://java.sun.com/jsf/html"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:a4j="http://richfaces.org/a4j">

    <ui:decorate template="../common/edit.xhtml">
        <ui:define name="label"><h:outputText value="#{messages.number}" id="numberLabel"/></ui:define>
        <h:inputText id="number" required="false" requiredMessage="#{messages.requiedMessage}"
                     value="#{customerBean.entity.number}" rendered="#{customerBean.requisiteEditing}"/>
        <ui:param name="required" value="false"/>
        <ui:param name="idInput" value="number"/>
        <ui:param name="value" value="#{customerBean.entity.number}"/>
        <ui:param name="editField" value="#{customerBean.requisiteEditing}"/>
    </ui:decorate>

    <ui:decorate template="../common/edit.xhtml">
        <ui:define name="label"><h:outputText value="#{messages.codeName}" id="codeNameLabel"/></ui:define>
        <h:inputText id="codeName" required="false" requiredMessage="#{messages.requiedMessage}"
                     value="#{customerBean.entity.codeName}" rendered="#{customerBean.requisiteEditing}"/>
        <ui:param name="required" value="false"/>
        <ui:param name="idInput" value="codeName"/>
        <ui:param name="value" value="#{customerBean.entity.codeName}"/>
        <ui:param name="editField" value="#{customerBean.requisiteEditing}"/>
    </ui:decorate>

    <ui:decorate template="../common/edit.xhtml">
        <ui:define name="label"><h:outputText value="#{messages.officialName}" id="officialNameLabel"/></ui:define>
        <h:inputText id="officialName" required="true" requiredMessage="#{messages.requiedMessage}"
                     value="#{customerBean.entity.officialName}"
                     rendered="#{customerBean.requisiteEditing}"/>
        <ui:param name="required" value="true"/>
        <ui:param name="idInput" value="officialName"/>
        <ui:param name="value" value="#{customerBean.entity.officialName}"/>
        <ui:param name="editField" value="#{customerBean.requisiteEditing}"/>
    </ui:decorate>

    <ui:decorate template="../common/edit.xhtml">
        <ui:define name="label"><h:outputText value="#{messages.address}" id="addressLabel"/></ui:define>
        <h:inputText id="address" required="false" requiredMessage="#{messages.requiedMessage}"
                     value="#{customerBean.entity.address}" rendered="#{customerBean.requisiteEditing}"/>
        <ui:param name="required" value="false"/>
        <ui:param name="idInput" value="address"/>
        <ui:param name="value" value="#{customerBean.entity.address}"/>
        <ui:param name="editField" value="#{customerBean.requisiteEditing}"/>
    </ui:decorate>

    <ui:decorate template="../common/edit.xhtml">
        <ui:define name="label"><h:outputText value="#{messages.phone}" id="phoneLabel"/></ui:define>
        <h:inputText id="phone" required="false" requiredMessage="#{messages.requiedMessage}"
                     value="#{customerBean.entity.phone}" rendered="#{customerBean.requisiteEditing}"/>
        <ui:param name="required" value="false"/>
        <ui:param name="idInput" value="phone"/>
        <ui:param name="value" value="#{customerBean.entity.phone}"/>
        <ui:param name="editField" value="#{customerBean.requisiteEditing}"/>
    </ui:decorate>

    <ui:decorate template="../common/edit.xhtml">
        <ui:define name="label"><h:outputText value="#{messages.region}" id="regionLabel"/></ui:define>
        <h:selectOneMenu id="region" required="false" requiredMessage="#{messages.requiedMessage}"
                         value="#{customerBean.entity.region}" rendered="#{customerBean.requisiteEditing}">
            <f:selectItems value="#{regionBeanController.selectList}"/>
            <f:converter converterId="regionConverter"/>
        </h:selectOneMenu>

        <a4j:region>
            <a4j:commandLink reRender="region" ajaxSingle="true" id="other" action="#{regionBeanController.preInsert}"
                             rendered="#{customerBean.requisiteEditing}">
                <h:outputText value="#{messages.other}"/>
            </a4j:commandLink>
        </a4j:region>

        <ui:param name="required" value="false"/>
        <ui:param name="idInput" value="region"/>
        <ui:param name="value" value="#{customerBean.entity.region.title}"/>
        <ui:param name="editField" value="#{customerBean.requisiteEditing}"/>
    </ui:decorate>

    <ui:decorate template="../common/edit.xhtml">
        <ui:define name="label"><h:outputText value="#{messages.fax}" id="faxLabel"/></ui:define>
        <h:inputText id="fax" required="false" requiredMessage="#{messages.requiedMessage}"
                     value="#{customerBean.entity.fax}" rendered="#{customerBean.requisiteEditing}"/>
        <ui:param name="required" value="false"/>
        <ui:param name="idInput" value="fax"/>
        <ui:param name="value" value="#{customerBean.entity.fax}"/>
        <ui:param name="editField" value="#{customerBean.requisiteEditing}"/>
    </ui:decorate>

    <ui:decorate template="../common/edit.xhtml">
        <ui:define name="label"><h:outputText value="#{messages.email}" id="emailLabel"/></ui:define>
        <h:inputText id="email" required="false" requiredMessage="#{messages.requiedMessage}"
                     value="#{customerBean.entity.email}" rendered="#{customerBean.requisiteEditing}">
            <f:validator validatorId="emailValidator"/>
        </h:inputText>
        <ui:param name="required" value="false"/>
        <ui:param name="idInput" value="email"/>
        <ui:param name="value" value="#{customerBean.entity.email}"/>
        <ui:param name="editField" value="#{customerBean.requisiteEditing}"/>
    </ui:decorate>

    <ui:decorate template="../common/edit.xhtml">
        <ui:define name="label"><h:outputText value="#{messages.website}" id="websiteLabel"/></ui:define>
        <h:inputText id="website" required="false" requiredMessage="#{messages.requiedMessage}"
                     value="#{customerBean.entity.website}" rendered="#{customerBean.requisiteEditing}"/>
        <ui:param name="required" value="false"/>
        <ui:param name="idInput" value="website"/>
        <ui:param name="value" value="#{customerBean.entity.website}"/>
        <ui:param name="editField" value="#{customerBean.requisiteEditing}"/>
    </ui:decorate>

    <h:commandButton value="#{messages.create}" id="create" action="#{customerBeanController.inserted}"
                             rendered="#{customerBean.newEntity}">
        <f:setPropertyActionListener value="false" target="#{customerBean.requisiteEditing}"/>
    </h:commandButton>
    <a4j:commandButton value="#{messages.cancel}" id="cancel" action="#{customerBeanController.cancel}"
                             rendered="#{customerBean.newEntity}" ajaxSingle="true" />

</h:panelGrid>